package com.xt.string;

import java.util.Scanner;

public class StringTest {
    public static void main(String[] args) {
        for (int i = 0; i < 3; i++) {
            Scanner sc = new Scanner(System.in);
            System.out.println("请输入登录名称");
            String loginName = sc.nextLine();
            System.out.println("请您输入登录密码");
            String password = sc.nextLine();
            boolean rs = login(loginName, password);
            if (rs) {
                System.out.println("登录成功");
                break;
            } else {
                System.out.println("您的输入有误");
            }
        }
    }

    public static boolean login(String loginName, String password) {
        // 3. 准备一份系统正确的登录名和密码
        String okLoginName = "itheima";
        String okPassword = "123456";
        return loginName.equals(okLoginName) && password.equals(okPassword);
    }
}
